﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MidTestLib.Data;
using MidTestLib.Interface;

namespace MidTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string command = string.Empty;
            string input = string.Empty;
            string step = string.Empty;
            IEncryption se = new SimpleEncryption();

            if (args.Length == 3)
            {
                command = args[0];
                input = args[1];
                step = args[2];
            }
            else
            {
                Console.Write("Please select command (-e for encrypt, -d for decrypt): ");
                command = Console.ReadLine();
                Console.Write("Please enter string: ");
                input = Console.ReadLine();
                Console.Write("Please enter step: ");
                step = Console.ReadLine();
            }

            
            switch (command)
            {
                case "-e":
                    bool status = se.Encrypt(ref input, step);
                    Console.WriteLine("Encrypt {0} : {1}", status.ToString(), input);
                    break;
                case "-d":
                    status = se.Decrypt(ref input, step);
                    Console.WriteLine("Decrypt {0} : {1}", status.ToString(), input);
                    break;
                default:
                    Console.WriteLine("{0} Not correct command.", command);
                    break;
            }

            Console.WriteLine("Press any key to exit..");
            Console.Read();
        }
    }
}
